//
//  SHVisitorViewController.swift
//  SHWeibo01
//
//  Created by 卫平玉 on 16/7/19.
//  Copyright © 2016年 卫平玉. All rights reserved.
//

import UIKit

class SHVisitorViewController: UIViewController {

    
    var isLogin: Bool = SHUserAccountViewModel.sharedTools.isLogin
    
    var visitorView: SHVisitorView?
    
    override func loadView() {
        isLogin ? (view = tableView) : setupVisitorView()
    }
    
    func setupVisitorView(){
        
        visitorView = SHVisitorView()
        
        visitorView?.closure = {[weak self] in
            
            self?.ClickLoginBtn()
        }
        
        view = visitorView
        
        setupNav()
        
    }
    
    func setupNav(){
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", target: self, action: "ClickLoginBtn")
        
        navigationItem.rightBarButtonItem = SHBarButtonItem(title: "注册", target: self, action: "ClickLoginBtn")
        
    }
    
    @objc private func ClickLoginBtn(){
        
        let OAuthVC = SHOAuthViewController()
        
        presentViewController(UINavigationController.init(rootViewController: OAuthVC), animated: true, completion: nil)
    }
    override func viewDidLoad() {
        super.viewDidLoad()

    }
    //前面加了private在homeViewController中将不会找到这个tableView
    
     lazy var tableView: UITableView = UITableView()

}
